<?php


namespace app\api\controller;


use think\Request;

class Performer extends Base
{
    public function getPerformerList(Request $request){
        $res = [];
        $data = $request->post();
        if(!isset($data['status'])){
            $res['status'] = 400;
            echo json_encode($res);die;
        }

        $performer = new \app\admin\model\Performer();
        $where['status'] = $data['status'];
        $list = $performer->getAll($where);
        if($list == null){
            $res['data']['code'] = 0;
            $res['data']['msg'] = '获取失败';
        }else{
            $res['data']['code'] = 1;
            $res['data']['msg'] = '获取成功';
            $res['data']['list'] = $list;
        }

        $res['status'] = 200;
        echo json_encode($res);
    }

    public function getPerformerDetail(Request $request){
        $res = [];
        $data = $request->post();
        if(!isset($data['id'])){
            $res['status'] = 400;
            echo json_encode($res);die;
        }

        $performer = new \app\admin\model\Performer();
        $where['id'] = $data['id'];
        $rs = $performer->getOne($where);

        if($rs == null){
            $res['data']['code'] = 0;
            $res['data']['msg'] = '获取失败';
        }else{
            $res['data']['code'] = 1;
            $res['data']['msg'] = '获取成功';
            $res['data']['list'] = $rs;
        }

        $res['status'] = 200;
        echo json_encode($res);
    }
}